#include "CollaborativeFilter.h"

CollaborativeFilter::CollaborativeFilter(const E_CFAlgorithm& e_cfalgorithm) {
	switch (e_cfalgorithm) {
	case CORRELATION_BASED:
		Log::verbose("Correlation-Based Algorithm");
		cfalgorithm = new CorrelationBasedCF();
		break;
	case NAYVE_BAYES:
	case OTHER_BASED:
		break;
	}
}

CollaborativeFilter::~CollaborativeFilter() {
	delete cfalgorithm;
}

void CollaborativeFilter::makePrediction(const string& user_mac, int cid) {
	Log::log_oss << "Predicting rating for content id: " << cid;
	Log::verbose();
	cfalgorithm->setActiveUserMac(user_mac);
	cfalgorithm->predict(cid);
}

multimap<string, string> CollaborativeFilter::getTopNList(
		const string& user_mac, int n) {
	Log::log_oss << "Listing top " << n << " programs";
	Log::verbose();
	cfalgorithm->setActiveUserMac(user_mac);
	return cfalgorithm->getTopNList(n);
}
